package Server;

import Strukture.Cvor;
import Strukture.Stablo;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * MAIN metoda servera
 * @author ivail
 */
public class Main {
    
        public static void main (String args []){

              
             try {
                ServerInfo.setImeServera("MojPrviServer");
                ServerInfo.setLokacija("/home/ivail/ServerProba/");
                ServerInfo.setPodrzaniBrojKorisnika(10);
                ServerInfo.setPort(2222);
                
               Engine.napuniNizKorisnika();
               
               for (Korisnik k: Engine.korisnici){
                   System.out.println(k.getIme()+k.getSifra());
               }
               
               FileSystem.vratiStringIzListeUNormalan("/home/ivail/ilija/blic@@@@@12381223173123132");
               
                  
                  
                //zauzimamo port
                
                ServerSocket serverSoket = new ServerSocket(ServerInfo.getPort());
                
                while (true){
                    //server ceka klijenta
                    new ServerNit(serverSoket.accept()).start();
                }
//                
//                
//                
//                
//                
            } catch (IOException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }               
                
//                Korisnik k1 = new Korisnik("marko","zarko");
//                FileSystem.napraviFolderKorisnika(k1);
//        
//                FileSystem.napraviStablo(FileSystem.napraviKoreniCvor(k1), k1);
//                
//                for (String blabla: k1.getListaLokacijaFajlova()){
//                    System.out.println(blabla);
//                }
//                  for (String blabla: k1.getListaLokacijaFoldera()){
//                    System.out.println(blabla);
//                }     
            

        

    }
}
